﻿using DXApplicationTangche.UC.订单一览新.订单预览新.service;
using DXApplicationTangche.UC.项目成果管理.service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.项目成果管理
{
    public partial class Form审版分活 : DevExpress.XtraEditors.XtraForm
    {
        private List<审版分活DTO> 审版分活DTOs = new List<审版分活DTO>();
        public Form审版分活()
        {
            InitializeComponent();
            this.刷新();
        }

        private void textBox扫描生产批号_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyValue == 13)
            {
                List<审版分活扫码DTO> 审版分活扫码DTOs = new List<审版分活扫码DTO>();
                OrderCommitDTO返回 orderCommitDTO = 订单预览新Service.get订单预览By批号(this.textBox扫描生产批号.Text.Trim());
                审版分活扫码DTOs.Add(new 审版分活扫码DTO(this.textBox扫描生产批号.Text.Trim(),orderCommitDTO.styleNameCn));
                //扫码时调用接口创建审版任务分配状况
                List<审版分活DTO> 审版分活创建 = 项目成果Service.saveDesignVerify(审版分活扫码DTOs);
                if (审版分活创建.Count > 0)
                {
                    审版分活DTO 审版分活dto = new 审版分活DTO();
                    Form审版分活选择员工 Form审版分活选择员工 = new Form审版分活选择员工(this.textBox扫描生产批号.Text.Trim(), 审版分活dto);
                    Form审版分活选择员工.ShowDialog();
                    if (Form审版分活选择员工.is创建)
                    {
                        this.刷新();
                    }
                }               
            }
        }
        private void 刷新()
        {
            this.gridControl审版分活.DataSource = 项目成果Service.getDesignVerifyAll();
            this.gridView审版分活.RefreshData();
            this.gridView审版分活.ExpandAllGroups();
            this.textBox扫描生产批号.Clear();
        }
    }
}
